<template>
    <div class="project f f-ac f-jc">
        <div class="project-body">
            <Sub-title :label="title" padding="30px 0 10px" :color="id%2 == '0' ? '#fff' : '#000'" />
            <div class="f f-col f-ac f-jc">
                <img src="../../../assets/mountain-black.png" width="261px" height="80px" />
                <div class="fy-title mb-30" :style="{color: id%2 == '0' ? '#fff' : '#000'}">{{title}}</div>
            </div>
            <div class="f f-ac f-jb f-w">
                <div v-for="(i, k) in dataList" :key="k" class="project-item" @click="handleDetail(i)">
                    <img :src="baseUrl+i.image" />
                    <div class="title line-1">{{ i.title || "-" }}</div>
                    <div class="content line-2">{{ i.msg || "-" }}</div>
                </div>
            </div>
            <div class="f f-jc mt-20 mb-40" >
                <My-btn label="查看更多" width="198" height="52" bgColor="line-blue"
                    @click="handleMore" />
            </div>
        </div>
    </div>
</template>

<script>
    import {
        heritageList
    } from "@/utils/heritage/index.js";
    export default {
        props: {
            // 表单名称
            id: {
                type: Number,
                default: 1,
            },
            title: {
                type: String,
                default: '',
            },
        },
        created() {
            this.getList();
        },
        data() {
            return {
                baseUrl: process.env.VUE_APP_BASE_API,
                dataList: [],
            };
        },

        methods: {
            // 获取项目列表
            getList() {
                let that = this
                let data = {
                    heritage_category_id: this.id,
                    title: '',
                    type: '',
                    page: 1,
                    limit: 8,
                    recommend: 2
                }
                heritageList(data).then((response) => {
                    that.dataList = response.data.list
                });
            },
            // 查看详情
            handleDetail(item) {
                this.$router.push({
                    path: "/cultural/projectDetails",
                    query: {
                        id: item.id,
                    },
                });
            },
            // 查看更多
            handleMore() {
                this.$router.push({
                    path: "/cultural/culturalList",
                    query: {
                        // type: "project",
                        type: this.id,
                    },
                });
            },
        },
    };
</script>

<style lang="scss" scoped>
    .project {
        width: 100%;
        max-height: 1048px;
        /* background-color: #fff; */
        background-image: url("../../../assets/inherit_bg.png");
        background-size: 100% 100%;
        background-repeat: no-repeat;

        &-body {
            width: 1200px;
            height: 100%;

            .fy-title {
                margin-top: 15px;
                color: #313131;
                font-family: FZZhengHeiS-B-GB;
                font-size: 20px;
            }

            .project-item {
                width: 280px;
                height: 300px;
                border-radius: 5px;
                overflow: hidden;
                background-color: #fff;
                margin-bottom: 46px;
                transition: all 0.5s;
                box-shadow: 0 1px 10px 0 rgba(217, 217, 217, 0.3);

                &:hover {
                    cursor: pointer;
                    box-shadow: 0 1px 10px 0 rgba(0, 0, 0, 0.5);
                }

                img {
                    width: 100%;
                    height: 212px;
                }

                .title {
                    color: #313131;
                    font-size: 14px;
                    margin: 12px 10px 6px;
                }

                .content {
                    color: #909090;
                    font-size: 14px;
                    margin: 0 10px;
                }
            }
        }
    }
</style>